﻿<!--(C) Copyright 2009 Irantha Suwandarathna (iranthas@hotmail.com)-->
 <Window x:Class="EffiProz.Explorer.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="EffiProz Database Explorer" Height="600" Width="800" Icon="/EffiProz.Explorer;component/Icon.ico" Loaded="Window_Loaded" Closing="MainWindow_Closing" Closed="Window_Closed">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="23"  />
            <RowDefinition Height="*" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Menu Height="22" Name="menu1" VerticalAlignment="Top">

            <MenuItem Header="File" >
                <MenuItem Header="Connect..." Name="connectMenuItem" Click="connectMenuItem_Click" />
                <MenuItem Header="Disconnect" Name="disconnectMenuItem" Click="disconnectMenuItem_Click" />
                <Separator />
                <MenuItem Header="Open Script..." Name="openScriptMenuItem" Click="openScriptMenuItem_Click" />
                <MenuItem Header="Save Script..." Name="saveScriptMenuItem" Click="saveScriptMenuItem_Click" />
                <MenuItem Header="Save Result..." Name="saveResultsMenuItem" Click="saveResultsMenuItem_Click" />
                <Separator />
                <MenuItem Header="Exit" Name="exitMenuItem" Click="exitMenuItem_Click" />
            </MenuItem>
            <MenuItem Header="View">
                <MenuItem Header="Refresh Tree" Name="refreshTreeMenuItem" Click="refreshTreeMenuItem_Click" />
                <Separator />
                <MenuItem Header="Show Schema" Name="showSchemaMenuItem" Click="showSchemaMenuItem_Click" IsChecked="True" IsCheckable="True" />
                <MenuItem Header="Show System Tables" Name="showSystemTablesManuItem" Click="showSystemTablesManuItem_Click" IsCheckable="True" />
            </MenuItem>
            <MenuItem Header="Command">
                <MenuItem Header="SELECT" Name="selectMenuItem" Click="selectMenuItem_Click" />
                <MenuItem Header="INSERT" Name="insertMenuItem" Click="insertMenuItem_Click" />
                <MenuItem Header="UPDATE" Name="updateMenuItem" Click="updateMenuItem_Click" />
                <MenuItem Header="DELETE" Name="deleteMenuItem" Click="deleteMenuItem_Click" />
                <Separator />
                <MenuItem Header="CREATE TABLE" Name="createTableMenuItem" Click="createTableMenuItem_Click" />
                <MenuItem Header="DROP TABLE" Name="dropTableMenuItem" Click="dropTableMenuItem_Click" />
                <MenuItem Header="CREATE INDEX" Name="createIndexMenuItem" Click="createIndexMenuItem_Click" />
                <MenuItem Header="DROP INDEX" Name="dropIndexMenuItem" Click="dropIndexMenuItem_Click" />
                <Separator />
                <MenuItem Header="COMMIT" Name="commitMenuItem" Click="commitMenuItem_Click">
                    <MenuItem.Icon>
                        <Image Source="Resources\Run.gif"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="ROLLBACK" Name="rollbackMenuItem" Click="rollbackMenuItem_Click">
                    <MenuItem.Icon>
                        <Image Source="Resources\Run.gif"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="CHECKPOINT" Name="checkpointMenuItem" Click="checkpointMenuItem_Click">
                    <MenuItem.Icon>
                        <Image Source="Resources\Run.gif"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="SCRIPT" Name="scriptMenuItem" Click="scriptMenuItem_Click" />
                <MenuItem Header="SET" Name="setMenuItem" Click="setMenuItem_Click" />
                <MenuItem Header="SHUTDOWN" Name="shutdownMenuItem" Click="shutdownMenuItem_Click" />
            </MenuItem>
            <MenuItem Header="Options">
                <MenuItem Header="AutoCommit" IsCheckable="True" IsChecked="True" Name="autoCommitMenuItem" Click="autoCommitMenuItem_Click" />
                <Separator />
                <MenuItem Header="Set MaxRows to 1000" Name="maxRows1000MenuItem" IsChecked="True" IsCheckable="True" Click="maxRows1000MenuItem_Click" />
            </MenuItem>            
            <MenuItem Header="Help">
                <MenuItem Header="About" Click="MenuItem_Click" />
            </MenuItem>
        </Menu>

        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition  />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="5"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TreeView Grid.Column="0" Name="databaseTreeView"></TreeView>
            
            <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch"></GridSplitter>

            <Grid Grid.Column="2" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

               
                <ToolBarTray  Height="26" Margin="0,0,0,0" Name="toolBarTray1" VerticalAlignment="Top">
                    <ToolBar Name="ButtonBar" >
                        <Button Name="executeButton" IsEnabled="True" ToolTip="Execute SQL" Click="executeButton_Click">
                            <Image Source="/EffiProz.Explorer;component/Resources/Run.gif"></Image>
                        </Button>
                        <Separator></Separator>
                        <Button Name="clearButton" Click="clearButton_Click">Clear...</Button>
                    </ToolBar>
                </ToolBarTray>
                <Grid Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="100" />
                        <RowDefinition Height="5" />
                        <RowDefinition Height="*" />                       
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <RichTextBox AcceptsTab="True" Name="queryRichTextBox" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" FontSize="14" TextChanged="queryRichTextBox_TextChanged"></RichTextBox>
                    <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></GridSplitter>
                    <TabControl Grid.Row="2" Name="tabControl1">
                        <TabItem Header="Results" >
                            <my:DataGrid ItemsSource="{Binding Path=.}"  Name="resultsDataGrid"  xmlns:my="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" HorizontalScrollBarVisibility="Auto" IsReadOnly="True" />
                        </TabItem>
                        <TabItem Header="Messages" >
                            <TextBox Name="messagesTextBox" TextWrapping="Wrap" AcceptsTab="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" IsReadOnly="True"></TextBox>
                        </TabItem>
                    </TabControl>
                   
                </Grid>
            </Grid>
        </Grid>

        <StatusBar  Grid.Row="2" Name="statusBar">
            <StatusBarItem Name="connectionStatus" />
        </StatusBar>
        
    </Grid>
</Window>
